package com.neteast.bustruck.db.dao

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.Query
import androidx.room.Update
import com.neteast.bustruck.db.entiys.LocalSaveInfo
import com.neteast.bustruck.db.entiys.TmTruckLoadForm
import com.neteast.bustruck.db.entiys.TruckInfo
import com.neteast.bustruck.db.entiys.TruckLogInfo

@Dao
interface TruckLogDao {


    @Query("SELECT * FROM truck_log")
    suspend fun getAllList():List<TruckLogInfo>?

    @Query("SELECT * FROM truck_log WHERE truck_id LIKE :truck_id ORDER By insert_time DESC ")
    suspend fun getTruckLoadList(vararg truck_id:Int): List<TruckLogInfo>?




    @Query("SELECT * FROM truck_log WHERE username LIKE :userName and isUpdate = :isUpdata ORDER By insert_time Asc ")
    suspend fun getTruckLoadListByName( userName:String, isUpdata:Boolean): List<TruckLogInfo>?


    @Query("SELECT * FROM truck_log WHERE `current_circle_id ` LIKE :orderId and isUpdate = :isUpdata ORDER By insert_time Asc ")
    suspend fun getTruckLoadListByOrderId( orderId:String, isUpdata:Boolean): List<TruckLogInfo>?




    @Query("SELECT * FROM truck_log WHERE truck_id LIKE :truckId and isUpdate = :isUpdata ORDER By insert_time Asc ")
    suspend fun getTruckLoadListByTruckId( truckId:String, isUpdata:Boolean): List<TruckLogInfo>?


    @Insert
    suspend fun insertList(info: TruckLogInfo):Long


    @Update
    suspend fun updateLocalInfo(vararg info: TruckLogInfo) :Int


    @Delete

    suspend fun deleteAll(list:List<TruckLogInfo>):Int






}